﻿using System.ComponentModel.DataAnnotations;
using Admin.Framework.Core.Domain.Core;
using SqlSugar;

namespace Admin.Framework.Core.Domain.System
{
    public enum ActionLogInfosTypesEnum
    {
        [Display(Name = "普通")] Normal,
        [Display(Name = "异常")] Exception,
        [Display(Name = "调试")] Debug
    }

    public class ActionLogInfos : BaseEntity
    {
        [Display(Name = "控制器名称")]
        [Required(ErrorMessage = "{0} 必填项")]
        [StringLength(50, ErrorMessage = "{0}stringmax{1}")]
        [SugarColumn(IsNullable = false, Length = 50, ColumnDataType = "nvarchar", ColumnDescription = "控制器名称")]
        public string ModuleName { get; set; }

        [Display(Name = "方法名称")]
        [Required(ErrorMessage = "{0} 必填项")]
        [StringLength(50, ErrorMessage = "{0}stringmax{1}")]
        [SugarColumn(IsNullable = false, Length = 50, ColumnDataType = "nvarchar", ColumnDescription = "方法名称")]
        public string ActionName { get; set; }

        [Display(Name = "上级链接")]
        [Required(ErrorMessage = "{0} 必填项")]
        [StringLength(500, ErrorMessage = "{0}stringmax{1}")]
        [SugarColumn(IsNullable = false, Length = 500, ColumnDataType = "nvarchar", ColumnDescription = "上级链接")]
        public string PreUrl { get; set; }

        [Display(Name = "方法链接")]
        [Required(ErrorMessage = "{0} 必填项")]
        [StringLength(500, ErrorMessage = "{0}stringmax{1}")]
        [SugarColumn(IsNullable = false, Length = 500, ColumnDataType = "nvarchar", ColumnDescription = "方法链接")]
        public string ActionUrl { get; set; }

        [Display(Name = "方法执行时间")]
        [Required(ErrorMessage = "{0} 必填项")]
        [SugarColumn(IsNullable = false, Length = 2, ColumnDataType = "decimal", ColumnDescription = "方法执行时间")]
        public decimal Duration { get; set; }

        [Display(Name = "访问者IP地址")]
        [Required(ErrorMessage = "{0} 必填项")]
        [StringLength(200, ErrorMessage = "{0}stringmax{1}")]
        [SugarColumn(IsNullable = false, Length = 200, ColumnDataType = "nvarchar", ColumnDescription = "访问者IP地址")]
        public string InternetProtocol { get; set; }

        [Display(Name = "访问者用户代理")]
        [Required(ErrorMessage = "{0} 必填项")]
        [StringLength(200, ErrorMessage = "{0}stringmax{1}")]
        [SugarColumn(IsNullable = false, Length = 200, ColumnDataType = "nvarchar", ColumnDescription = "访问者用户代理")]
        public string UserAgent { get; set; }

        [Display(Name = "日志类型")]
        [Required(ErrorMessage = "{0} 必填项")]
        [SugarColumn(IsNullable = false, ColumnDataType = "int", ColumnDescription = "日志类型")]
        public ActionLogInfosTypesEnum LogType { get; set; }

        public object Clone()
        {
            return MemberwiseClone();
        }
    }
}